package com.lh.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lh.entity.table.ApprovalRecord;
import com.lh.entity.table.ChangeWarnLevel;
import com.lh.entity.table.DeadlineNode;
import com.lh.entity.table.RectificationInfo;
import com.lh.mapper.ChangeWarnLevelMapper;
import com.lh.mapper.DeadlineNodeMapper;
import com.lh.mapper.RectificationInfoMapper;
import com.lh.service.ChangeWarnLevelService;
import com.lh.utils.Answer;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class ChangeWarnLevelServiceImpl implements ChangeWarnLevelService {

    @Resource
    private ChangeWarnLevelMapper changeWarnLevelMapper;


    @Override
    public Answer<Object> getChangeWarnLevelPage(JSONObject reqJson) {
        Integer pageSize = reqJson.getInteger("pageSize");
        Integer pageNum = reqJson.getInteger("pageNum");
        IPage<ChangeWarnLevel> page = new Page<>(pageNum, pageSize);
        String title = reqJson.getString("title");

        IPage<ChangeWarnLevel> changeWarnLevelIPage = changeWarnLevelMapper.selectPage(page, new LambdaQueryWrapper<>());
        List<ChangeWarnLevel> records = changeWarnLevelIPage.getRecords();

        return Answer.ok(changeWarnLevelIPage);
    }
}
